//
//  ZYTableView.h
//  Merchant
//
//  Created by admin on 16/5/2.
//  Copyright © 2016年 ibendi. All rights reserved.
//

#import <UIKit/UIKit.h>


typedef NSInteger(^numberOfSectionsInTableViewCompletion)(UITableView * tableView);///<显示几个Section
typedef NSInteger(^numberOfRowsInSectionCompletion)( UITableView * tableView, NSInteger section);///< Section 显示Row的行数

typedef UITableViewCell * (^cellForRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);///< 自定义cell block
typedef CGFloat (^heightForRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);///< 修改行高 block
typedef BOOL (^canEditRowAtIndexPath)(UITableView *tableView, NSIndexPath *indexPath); ///< 需要滑动删除 block
typedef void (^didSelectRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);///< cell 点击block
typedef void (^didDeselectRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);



@interface ZYTableView : UIView<UITableViewDataSource,UITableViewDelegate>

@property (strong,nonatomic) UITableView *tableView;
/// 用于显示数据
@property (strong, nonatomic) NSMutableArray *resultsSource;
//编辑cell时显示的风格，默认为UITableViewCellEditingStyleDelete；会将值付给[tableView:editingStyleForRowAtIndexPath:]
@property (nonatomic) UITableViewCellEditingStyle editingStyle;

@property (nonatomic, assign) NSInteger cellHeight;
@property (nonatomic, assign) NSInteger page;

///  刷新数据
-(void)tableviewReloadDataWithData:(NSArray *)dataArray;
///  刷新数据
-(void)tableviewReloadData;


@property (copy,nonatomic)NSInteger (^numberOfSectionsInTableViewCompletion)(UITableView * tableView);
@property (copy,nonatomic)NSInteger (^numberOfRowsInSectionCompletion)( UITableView * tableView, NSInteger section);
@property (copy,nonatomic) UITableViewCell * (^cellForRowAtIndexPathCompletion)( UITableView * tableView, NSIndexPath *indexPath);
@property (copy,nonatomic) CGFloat (^heightForRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);
@property (copy,nonatomic) BOOL (^canEditRowAtIndexPath)(UITableView *tableView, NSIndexPath *indexPath);
@property (copy,nonatomic) void (^didSelectRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);
@property (copy,nonatomic) void (^didDeselectRowAtIndexPathCompletion)(UITableView *tableView, NSIndexPath *indexPath);


///  基本tableview 如果需要实现显示多个sencetion  需要实现该方法
-(void)zyNumberOfSectionsInTableView:(numberOfSectionsInTableViewCompletion)sectionsCompletion withNumberOfRowsInSection:(numberOfRowsInSectionCompletion)numCompletion;

///基本tableview的快速实现(推荐使用) cell自定义 点击方法 行高
-(void)zyCellForRowAtIndexPath:(cellForRowAtIndexPathCompletion)cellCompletion
   wihtDidSelectRowAtIndexPath:(didSelectRowAtIndexPathCompletion)didCompletion
   withHeightForRowAtIndexPath:(heightForRowAtIndexPathCompletion)cellHeightComplection;

/**
 *  默认实现cell 和点击方法
 *
 *  @param cellCompletion cell 自定义的代码块
 *  @param didCompletion  cell点击方法的代码块
 */
- (void)zyCellForRowAtIndexPath:(cellForRowAtIndexPathCompletion)cellCompletion wihtDidSelectRowAtIndexPath:(didSelectRowAtIndexPathCompletion)didCompletion;

///  显示几个Section方法
-(void)zyNumberOfSectionsInTableViewCompletion:(numberOfSectionsInTableViewCompletion)completion;
///  自Section 显示Row的行数
-(void)zyNumberOfRowsInSectionCompletion:(numberOfRowsInSectionCompletion)completion;
///  自定义cell 方法
-(void)zyCellForRowAtIndexPathCompletion:(cellForRowAtIndexPathCompletion)completion;
///  修改行高 方法
-(void)zyHeightForRowAtIndexPathCompletion:(heightForRowAtIndexPathCompletion)completion;
///  需要实现删除方法
-(void)zyCanEditRowAtIndexPath:(canEditRowAtIndexPath)completion;
///  cell点击方法
-(void)zyDidSelectRowAtIndexPathCompletion:(didSelectRowAtIndexPathCompletion)completion;
-(void)zyDidDeselectRowAtIndexPathCompletion:(didDeselectRowAtIndexPathCompletion)completion;

/**
 *  添加下拉刷新控件
 */
-(void)zyAddTableViewHeaderView:(void(^)(NSInteger page))refreshingBlock;
/**
 *  添加上提加载控件
 */
-(void)zyAddTableViewFooterView:(void(^)(NSInteger page))refreshingBlock;
/**
 *  foot 显示结束刷新 显示没有更多数据
 */
-(void)zyEndRefreshingWithNoMoreData;
/**
 *  结束刷新上提加载
 */
-(void)zyFooterEndRefreshing;
/**
 *  结束下拉刷新
 */
-(void)zyHeaderEndRefreshing;




@end










